
-- Database has: 11 tables.
USE [WebSecurity]
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO


/****** Object:  Table [dbo].[UserProfile] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserProfile]') AND type in (N'U'))
DROP TABLE [dbo].[UserProfile]
GO




CREATE TABLE [dbo].[UserProfile]
	(
    [UserId] [Int] Identity(1,1) NOT NULL, 
    				[UserName] [NVarChar](30) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[IsActive] [Bit],
				[FirstName] [NVarChar](50) NOT NULL,
				[LastName] [NVarChar](50) NOT NULL,
				[Address] [NVarChar](250) NOT NULL,
				[City] [NVarChar](50) NOT NULL,
				[Region] [NVarChar](50) NOT NULL,
				[PostalCode] [NVarChar](25) NOT NULL,
				[OfficePhone] [NVarChar](25) NOT NULL,
				[CellPhone] [NVarChar](25) NOT NULL,
				[Title] [NVarChar](100) NOT NULL,
CONSTRAINT [PK_UserProfile] PRIMARY KEY CLUSTERED (
[UserId] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[Membership] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Membership]') AND type in (N'U'))
DROP TABLE [dbo].[Membership]
GO




CREATE TABLE [dbo].[Membership]
	(
    [MembershipID] [Int] Identity(1,1) NOT NULL, 
    				[ConfirmationToken] [NVarChar](128) NOT NULL,
				[IsConfirmed] [Bit],
				[LastPasswordFailureDate] [DateTime],
				[PasswordFailuresSinceLastSuccess] [Int],
				[Password] [NVarChar](128) NOT NULL,
				[PasswordChangedDate] [DateTime],
				[PasswordSalt] [NVarChar](128) NOT NULL,
				[PasswordVerificationToken] [NVarChar](128) NOT NULL,
				[PasswordVerificationTokenExpirationDate] [DateTime],
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[EmailAccount] [NVarChar](255) NOT NULL,
				[PasswordAnswer] [NVarChar](250) NOT NULL,
				[LastLoginDate] [DateTime],
				[LastLockoutDate] [DateTime],
				[UserId] [Int],
				[PasswordQuestionID] [Int],
CONSTRAINT [PK_Membership] PRIMARY KEY CLUSTERED (
[MembershipID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[OAuthMembership] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OAuthMembership]') AND type in (N'U'))
DROP TABLE [dbo].[OAuthMembership]
GO




CREATE TABLE [dbo].[OAuthMembership]
	(
    [OAuthMembershipID] [Int] Identity(1,1) NOT NULL, 
    				[Provider] [NVarChar](30) NOT NULL,
				[ProviderUserID] [NVarChar](100) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[UserId] [Int],
CONSTRAINT [PK_OAuthMembership] PRIMARY KEY CLUSTERED (
[OAuthMembershipID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[ApplicationRoles] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ApplicationRoles]') AND type in (N'U'))
DROP TABLE [dbo].[ApplicationRoles]
GO




CREATE TABLE [dbo].[ApplicationRoles]
	(
    [ApplicationRoleId] [Int] Identity(1,1) NOT NULL, 
    				[RoleName] [NVarChar](256) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[ApplicationID] [Int],
CONSTRAINT [PK_ApplicationRoles] PRIMARY KEY CLUSTERED (
[ApplicationRoleId] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[UsersInRoles] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UsersInRoles]') AND type in (N'U'))
DROP TABLE [dbo].[UsersInRoles]
GO




CREATE TABLE [dbo].[UsersInRoles]
	(
    [UsersInRoleID] [Int] Identity(1,1) NOT NULL, 
    				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[UserId] [Int],
				[ApplicationRoleId] [Int],
CONSTRAINT [PK_UsersInRoles] PRIMARY KEY CLUSTERED (
[UsersInRoleID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[Application] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Application]') AND type in (N'U'))
DROP TABLE [dbo].[Application]
GO




CREATE TABLE [dbo].[Application]
	(
    [ApplicationID] [Int] Identity(1,1) NOT NULL, 
    				[ApplicationName] [NVarChar](100) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
CONSTRAINT [PK_Application] PRIMARY KEY CLUSTERED (
[ApplicationID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[PasswordQuestion] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PasswordQuestion]') AND type in (N'U'))
DROP TABLE [dbo].[PasswordQuestion]
GO




CREATE TABLE [dbo].[PasswordQuestion]
	(
    [PasswordQuestionID] [Int] Identity(1,1) NOT NULL, 
    				[PasswordQuestionDesc] [NVarChar](250) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
CONSTRAINT [PK_PasswordQuestion] PRIMARY KEY CLUSTERED (
[PasswordQuestionID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[UserProfileData] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UserProfileData]') AND type in (N'U'))
DROP TABLE [dbo].[UserProfileData]
GO




CREATE TABLE [dbo].[UserProfileData]
	(
    [UserProfileDataID] [Int] Identity(1,1) NOT NULL, 
    				[UPDName] [NVarChar](100) NOT NULL,
				[UPDValue] [NVarChar](100) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[UserId] [Int],
CONSTRAINT [PK_UserProfileData] PRIMARY KEY CLUSTERED (
[UserProfileDataID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[ApplicationUser] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ApplicationUser]') AND type in (N'U'))
DROP TABLE [dbo].[ApplicationUser]
GO




CREATE TABLE [dbo].[ApplicationUser]
	(
    [ApplicationUserID] [Int] Identity(1,1) NOT NULL, 
    				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[UserId] [Int],
				[ApplicationID] [Int],
CONSTRAINT [PK_ApplicationUser] PRIMARY KEY CLUSTERED (
[ApplicationUserID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[ApplicationProfileData] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ApplicationProfileData]') AND type in (N'U'))
DROP TABLE [dbo].[ApplicationProfileData]
GO




CREATE TABLE [dbo].[ApplicationProfileData]
	(
    [ApplicationProfileDataID] [Int] Identity(1,1) NOT NULL, 
    				[ApplicationProfileDataKey] [NVarChar](100) NOT NULL,
				[ApplicationProfileDataValue] [NVarChar](4) NOT NULL,
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
				[ApplicationID] [Int],
CONSTRAINT [PK_ApplicationProfileData] PRIMARY KEY CLUSTERED (
[ApplicationProfileDataID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO



/****** Object:  Table [dbo].[DomainName] Script Date: 1/21/2013 12:00:00 AM ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DomainName]') AND type in (N'U'))
DROP TABLE [dbo].[DomainName]
GO




CREATE TABLE [dbo].[DomainName]
	(
    [DomainNameID] [Int] Identity(1,1) NOT NULL, 
    				[EmailDomain] [NVarChar](255) NOT NULL,
				[DomainDeny] [Bit],
				[TS] [TimeStamp],
				[CreatedBy] [VarChar](50) NOT NULL,
				[CreatedDt] [DateTime],
				[ModifiedBy] [VarChar](50) NOT NULL,
				[ModifiedDt] [DateTime],
CONSTRAINT [PK_DomainName] PRIMARY KEY CLUSTERED (
[DomainNameID] ASC
) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
)  ON [PRIMARY]
		
GO

  
SET ANSI_PADDING OFF
GO  

